<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<script type="text/javascript">
	function sparepartCategoryTree_onNodeClick(event, treeId, treeNode) {

		sparepartGrid.search({
			"field" : "stp_category_path",
			"op" : "bw",
			"data" : treeNode.treenodePath
		});
	}
	
	function getSparepartCategoryTreeNode() {
		var nodes = sparepartCategoryTree.zTree.getSelectedNodes();

		if (nodes  && nodes != "") {
			return "categoryId=" + nodes[0].id;
		}
		
		isperp.alert("请选择节点！");
		return false;
	}
</script>

<div id="dvFrameMainNav" class="frame-main-nav" style="position:fixed">
	<isperp:tree id="sparepartCategoryTree" modal="false">
		<isperp:async enable="true"
			url="sparepart/category/getTree?showRoot=true">
		</isperp:async>
		<isperp:callback onClick="sparepartCategoryTree_onNodeClick">
		</isperp:callback>
	</isperp:tree>
</div>
<div class="box-right">
	<div class="box no-border">

		<isperp:grid gridId="sparepartGrid"
			url="sparepart/sparepart/old/findSparepartTotal"
			cusViewUrl="sparepart/sparepart/old/viewEdit"
			cusFormatterActions="true" sortname="cur_stock_quantity" sortorder="desc"
			excelExportUrl="sparepart/sparepart/old/excelExport"
			ondbClickRowEvent="sparepartGrid.view(rowid);">
			<jsp:attribute name="searchbar">	
				<table class="search-table">
					<tbody>
						<tr>
							<td class="td1">编号：</td>
							<td class="td2"><input type="text" field="code" op="cn">
							</td>
							<td class="td1">名称：</td>
							<td class="td2"><input type="text" field="name" op="cn">
							</td>
							
						</tr>
						<tr>
						  <td class="td1">型号：</td>
							<td class="td2" colspan="3"><input type="text" field="model" op="cn">
							</td>
							</tr>
					</tbody>
				</table>
				</jsp:attribute>
			<jsp:attribute name="toolbar">
				
				</jsp:attribute>
			<jsp:body> 
				<isperp:column name="id" title="id" hidden="true"></isperp:column>
				<isperp:column name="code" title="编号" width="90">
				</isperp:column>
				<isperp:column name="name" title="名称" width="70">
				</isperp:column>
				<isperp:column name="spt_category_name" title="分类" width="90">
				</isperp:column>
				<isperp:column name="model" title="型号" width="60">
				</isperp:column>
				<isperp:column name="cur_stock_quantity" title="当前库存" width="60">
				</isperp:column>
				<isperp:column name="out_stock_quantity" title="出库数量" width="60">
				</isperp:column>
				<isperp:column name="discard_quantity" title="报废数" width="60">
				</isperp:column>
				<isperp:column name="repair_quantity" title="维修数" width="60">
				</isperp:column>
				
				</jsp:body>

		</isperp:grid>
	</div>
	<isperp:operate code="SPT_SEARCH"></isperp:operate>
</div>

<script type="text/javascript">

	function statusFormatter(cellvalue) {
		if (cellvalue == 1)
				return "<img title='库存告警：当前库存小于最小库存！' src='img/ci/overtime.gif'>";
			else
				return "";

	}
</script>